<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>

<div class="modal-header">
	<button class="close" data-dismiss="modal">×</button>
	<h3>保存书签</h3>
</div>
<form id="linkForm" method="post" action=<s:property value="formUrl"/> >
	<div class="modal-body">
		<div class="row">
			<div class="span2">
				<label>标签</label><input name="bookmark.tags" id="urlTags"
					type="text" class="tags"
					value="<s:property value="bookmark.tags"/>" />
			</div>
			<div class="span4">
				<label>标题</label> <input name="bookmark.title" class="input-xlarge"
					value="<s:property value="bookmark.title"/>" type="text"> <label>链接</label>
				<input name="bookmark.url"
					value="<s:property value="bookmark.url"/><s:property value="linkUrl"/>" class="input-xlarge"
					type="text" /> <label>描述</label>
				<textarea name="bookmark.description" class="input-xlarge" rows="4"><s:property value="bookmark.description" /></textarea>
				<input name="bookmark.user_id" type="hidden"
					value="<s:property value="bookmark.user_id"/>" />
			</div>
		</div>
	</div>
	<div class="modal-footer">
		<div class="controls">
			<label class="checkbox inline"> <input type="checkbox"
				name="bookmark.ispublic" checked>公开
			</label> <a class="btn" data-dismiss="modal" href="#">关闭</a>
			<button id="submitLink" class="btn btn-primary">保存</button>
		</div>
	</div>
</form>

<script>
	$(function() {
		$('#urlTags').tagsInput({
			width : 'auto'
		});
		$('#submitLink').click(function() {
			$.post($('#linkForm').attr("action"), $('#linkForm').serialize(), function(response) {
				var result = $.parseJSON(response);
				if (result.success) {
					$('#saveLink').modal('hide');
					$('#linkUrl').val('');
					window.location.reload();
				} else
					alert(response);
			});
			return false;
		});
	});

	
</script>